home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / hypercrd / xcmds / rtf-redr.hqx / lists.h < prev    next >
Text File  |  1992-12-19  |  1KB  |  43 lines

  1. /*
  2.  * This software is copyright 1992 by Robert Morris.
  3.  * You may freely redistribute this software as shareware
  4.  * if you do so in the same form as you got it. If you find
  5.  * this software useful, please send $12 to:
  6.  *   Robert Morris
  7.  *   P.O. Box 1044
  8.  *   Harvard Square Station
  9.  *   Cambridge, MA 02238
  10.  *   ecognome@aol.com
  11.  * If you incorporate any of this software in any kind of
  12.  * commercial product, please send $2 per copy distributed
  13.  * to the above address.
  14.  */
  15.    
  16. struct list{
  17.     char **h;
  18.     long size;    /* result of GetHandleSize(h) */
  19.     long ptr;    /* where to read or write next */
  20. };
  21.  
  22. #define AppendListChar(lp, c) ((lp)->ptr + 2 > (lp)->size ? \
  23.                                _ALC((lp), (c)) : \
  24.                                ((*((lp)->h))[(lp)->ptr++] = (c), \
  25.                                 (*((lp)->h))[(lp)->ptr] = '\0'))
  26.                                 
  27. #define _AppendListChar(lp, c) ((lp)->ptr + 1 > (lp)->size ? \
  28.                                 _ALC((lp), (c)) : \
  29.                                 ((*((lp)->h))[(lp)->ptr++] = (c)))
  30.                                 
  31. #define ReadListChar(lp) ((lp)->ptr < (lp)->size ? \
  32.                           (*((lp)->h))[(lp)->ptr++] & 0xff : \
  33.                           -1)
  34.  
  35. long NewList(char **, struct list *);
  36. void FreeList(struct list *);
  37. long PeekListLine(struct list *, char []);
  38. long ReadListLine(struct list *, char []);
  39. long AppendList(struct list *, char []);
  40. long TrimList(struct list *);
  41. void RewindListLine(struct list *);
  42. char *item(int itm, char *in, char *out, int sep);
  43. int _ALC(struct list *, int);